import instance from "../http";

import {IAccount,ILoginResult,IDataType} from './type'
enum LoginAPI{
    AccountLogin = './login',
    LoginUserInfo = './users/',    //用法：/user/1
    UserMenus = './role/',     //用法：role/1/menu
}
export function accountLoginRequest(account:IAccount){
    return instance.post<IDataType<ILoginResult>>({
        url:LoginAPI.AccountLogin,
        data:account
    })
}

export function requestUserInfoById(id:number){
    return instance.get<IDataType>({
        url:LoginAPI.LoginUserInfo + id,
    })
}

export function requestUserMenusByRoleId(id:number){
    return instance.post<IDataType>({
        url:LoginAPI.UserMenus + id +'/menu',
    })
}